// TOWN DIALOGUE SCRIPT
//    Town 159: Bremerton

begintalkscript;

variables;

short i,j,k,r1,choice;

// Vagro

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Vagro";
	text1 = "Despite the niceness of his shop and the quality of his clothes, this man's essential scruffiness cannot help but shine through. His work takes up the time more ordinary people spend bathing.";
	text2 = "He is polishing a small blue crystal. _I'm Vagro,_ he says in a raspy voice. _Welcome to the crystalworks._";
	text5 = "Vagro is still polishing the same small blue crystal. It looks as smooth and shiny as it could possibly be. Yet he is still working on it. It must have flaws so fine and subtle it takes a lifetime's experience to perceive them.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_Is this your shop?_";
	text1 = "_Aye. I run this fine crystal shop here. Feel free to browse._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What can the crystals be used for?_";
	text1 = "_I have crystals of all sorts, for luck, for decoration, and for spell casting. Quite a nice selection, in fact, all of it for purchase at reasonable rates._ He grins. _Great business, eh? Definitely a step up from my sailor days._";
	text3 = "_I have crystals of all sorts, for luck, for decoration, and for spell casting. A very handy thing for Anama like you to have. They aren't actually magic, you see._ He grins. _Great business, eh? Definitely a step up from my sailor days._";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_How did being a sailor suit you?_";
	text1 = "He scratches himself cheerfully. _I was quite the wild one when I was younger. The stories I could tell._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Would you share a story?_";
	text1 = "He chuckles. _Oh, you don't want to hear the stuff I was up to. Though once, I was up to a bit of larceny with an old dog named Abruzzo. We got a big pile of loot, and he took it all and fled west._";
	text2 = "He grins mischievously. _If you ever meet him, mention my name to him. It'll sure give him a start!_";
	action = SET_SDF 159 11 1;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Can I buy some of your fine crystals?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Vagro's Crystals","Vagro has mastered the rare and difficult art of shaping magical crystals. It's a very rare art for a human to have.",112,5,3);
	break;

begintalknode;
	state = 1;
	nextstate = 5;
	question = "_How did you learn to work crystals?_";
	text1 = "_Well, I was a pirate on the surface. Got caught. Thrown into Avernum. When the Empire invaded, I joined up and helped them. Served in a place called Ornotha Ziggurat._";

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_So you betrayed Avernum?_";
	text1 = "_I never joined Avernum. Wouldn't listen to their dumb rules, so they threw me into the Abyss. That's where a Dervish found me._";

begintalknode;
	state = 5;
	nextstate = 6;
	question = "_What happened then?_";
	text1 = "_I was an assistant in the lab. They were studying one of these Crystal Soul things. While I was there, I picked up a lot of things about how to work crystals, on my own._";
	text2 = "_They brought me up to the surface to pick my brains. And a lucky thing, too._";

begintalknode;
	state = 6;
	nextstate = -1;
	question = "_Why lucky?_";
	text1 = "_Just days after I left, some vahnatai attacked. A group of raiders snuck into the ziggurat and killed, well, just about anyone. Stole the Crystal Soul too._";
	text2 = "_If I'd been there, I'm sure I'd be dead now._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I don't need any crystals._";
	text1 = "_Yes you do, whether you realize it or not. I hope you come to your senses before a lack of crystals kils you._";
	action = END_TALK;

// Craswell

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Craswell";
	text1 = "You meet an older woman. She looks like someone's perpetually angry grandmother. Her smile is cold, and her skin is stretched tight over her face.";
	text2 = "She is surrounded by awls, steel scissors, and the other tools of her leatherworking. _I am Craswell._";
	text5 = "_What else would like? Fine crafting, perhaps?_ You notice that she is wearing an Anama ring.";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_Is this a store?_";
	text1 = "She graces you with a pinched smile. _Of sorts. I do leatherworking. Nothing off the shelf. All custom, bespoke work. Fine leather armor might save you._";
	code =
		sf(159,17,1);
	break;
	
begintalknode;
	state = 30;
	nextstate = 31;
	question = "_Save me from what?_";
	text1 = "_The monsters. The swarms that purge Valorim. We might as well try to save ourselves, though it is futile._";

begintalknode;
	state = 31;
	nextstate = 32;
	question = "_Why did you say it's futile?_";
	text1 = "_Why even attempt to flee them? After all, they are so clearly a judgment!_";

begintalknode;
	state = 32;
	nextstate = 33;
	question = "_A judgment by whom for what?_";
	text1 = "_They are a punishment for our wicked, magic-using ways! The Gods have frowned on us, and this is our punishment. Do you think a mere jerkin, no matter how finely made, will help you escape the wrath of the almighty?_";
	text2 = "_Have you, perhaps, heard of the Anama?_";

begintalknode;
	state = 33;
	nextstate = -1;
	question = "_Tell me about the Anama._";
	text1 = "_We believe that magic is a demonic art, and its use will lead you into Hell. I strongly suggest you repent. Otherwise, no spell or armor in the world will save you from your cruel, eternal judgment._ The conversation seems to have taken a dark turn.";
	text3 = "She notices your Anama rings and nods in approval. _ You must know this already._ Oddly, she doesn't wear an Anama ring.";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 29;
	nextstate = 35;
	condition = gf(159,17) > 0;
	question = "_Can you make armor for me?_";
	text1 = "_I can. My time costs five hundred coins. My best patterns require at least seven pieces of the finest leather and three focusing crystals for directing my power._";
	text2 = "_Also, I have recently learned a very interesting way of coating cured leather. If you have located a gazer eyestalk of high quality, I can make a remarkable pair of gloves._";

begintalknode;
	state = 35;
	nextstate = 29;
	condition = num_of_item(294) < 7 || num_of_item(295) < 3 || coins_amount() < 500;
	question = "_I don't have what you need._";
	text1 = "_Oh. _Well, return when you do. I am busy preparing for the end._";
	action = END_TALK;

begintalknode;
	state = 35;
	nextstate = -1;
	condition = num_of_item(294) >= 7 && num_of_item(295) >= 3 && coins_amount() >= 500;
	question = "_Please make a new cloak._ Give 7 leather, 3 crystals, and 500 coins.";
	text1 = "You give her the materials and cash. She says, _Go away._";
	text2 = "So you do. You hang out in the bar for a few hours. When you return, Craswell has a nice, new cloak for you.";
	action = REUSABLE;
	code =
		take_num_of_item(294,7);
		take_num_of_item(295,3);
		change_coins(-500);
		reward_give(18);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 35;
	nextstate = -1;
	condition = num_of_item(294) >= 7 && num_of_item(295) >= 3 && coins_amount() >= 500;
	question = "_Please make a new pair of boots._ Give 7 leather, 3 crystals, and 500 coins.";
	text1 = "You give her the materials and cash. She says, _Go away._";
	text2 = "So you do. You hang out in the bar for a few hours. When you return, Craswell has a nice, new pair of boots for you.";
	action = REUSABLE;
	code =
		take_num_of_item(294,7);
		take_num_of_item(295,3);
		change_coins(-500);
		reward_give(151);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 35;
	nextstate = -1;
	condition = num_of_item(294) >= 7 && num_of_item(295) >= 3 && coins_amount() >= 500;
	question = "_Please make a new cap._ Give 7 leather, 3 crystals, and 500 coins.";
	text1 = "You give her the materials and cash. She says, _Go away._";
	text2 = "So you do. You hang out in the bar for a few hours. When you return, Craswell has a nice, new leather cap for you.";
	action = REUSABLE;
	code =
		take_num_of_item(294,7);
		take_num_of_item(295,3);
		change_coins(-500);
		reward_give(461);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 35;
	nextstate = -1;
	condition = num_of_item(294) >= 9 && num_of_item(295) >= 3 && num_of_item(438) > 0 && coins_amount() >= 500;
	question = "_Please make a really nice pair of gloves._ Give 9 leather, 3 crystals, an eyestalk, and 500 coins.";
	text1 = "You give her the materials and cash. She says, _Go away._";
	text2 = "So you do. You hang out in the bar for a few hours. When you return, Craswell has a beautiful pair of gloves for you.";
	action = REUSABLE;
	code =
		take_num_of_item(294,9);
		take_num_of_item(295,3);
		take_num_of_item(438,1);
		change_coins(-500);
		reward_give(188);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 35;
	nextstate = -1;
	condition = num_of_item(294) >= 7 && num_of_item(295) >= 3 && coins_amount() >= 500;
	question = "_I have the materials, but you can't have them._";
	text1 = "_It's your loss. Go away._";
	action = END_TALK;

begintalknode;
	state = 31;
	nextstate = -1;
	question = "_I don't need anything else for now. Thanks._";
	text1 = "_All right. I will be here. Come to get armor. Or help saving your souls from dark powers._";
	action = END_TALK;

